<?
 	session_start();
 	require("checksessionsodaubai.php");
 	require("connect.php"); 
?>
<html><!-- InstanceBegin template="/Templates/sodaubaitemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="Javascript" src="scripts/innovaeditor.js"></script>
<link rel="stylesheet" type="text/css" href="css/engine.css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script language="javascript" type="text/javascript" src="js/datetimepicker.js">
</script>
</head>
<body>
<table align="center" width="938" cellpadding="0" cellspacing="0" border="0">
	<tr><td colspan="2" height="26" bgcolor="#CCCCCC">
	<? $malop=$_REQUEST["mal"];
	$resu99=mysql_query("select * from lop where mal='{$malop}'");
		$row99=mysql_fetch_array($resu99);
	?>	
	<!--Menu 1-->
	<div id="tool">

	<a href="index.php">Trang chủ trường</a>
		 | 
		  <a href="hotrohoctap.php">Hỗ trợ học tập</a>
		  |		
		<a href="lienhe.php">Liên hệ</a>
	</div>
	<!--het menu 1-->
	</td></tr>
	<tr><td colspan="2" height="34" bgcolor="#CCCCCC">
	<div id="menuwrapper">
		<ul id="p7menubar">
			 <li><a class="trigger" href="lopcuatoi.php?mal=<? echo $malop;?>" target="_self">Trang chủ <? echo $row99["tenl"];?></a></li>										  	
		  <li class="linemenus"></li>					 
		  <li>
		  <?
		  	if ($_SESSION["login"]!=true){
		  ?>		  
		  <a class="trigger" href="login.php" target="_self">Trang cá nhân</a>
		  <? } else {
		  		if($_SESSION["quyen"]==0) {
		  ?>	
		   			<a class="trigger" href="admin/index.php" target="_self">Trang cá nhân</a>
		  		<? } else if($_SESSION["quyen"]==1) {?>
					<a class="trigger" href="giaovien.php?magv=<? echo $_SESSION["username"];?>" target="_self">Trang cá nhân</a>
				<? } else if($_SESSION["quyen"]==2) {?>
					<a class="trigger" href="trangphuhuynh.php?maph=<? echo $_SESSION["username"];?>&mal=<? echo $malop;?>" target="_self">Trang cá nhân</a>
				<? } else if(($_SESSION["quyen"]==3) || ($_SESSION["quyen"]==4)) {?>
					<a class="trigger" href="tranghocsinh.php?mahs=<? echo $_SESSION["username"];?>&mal=<? echo $malop;?>" target="_self">Trang cá nhân</a>
				<? }?>
		  		
		  <? }?>
		  <!--bat dau phan dang nhap-->
		  <?
				if ($_SESSION["login"]!=true){
			?>
			 <li class="linemenus"></li>					 
		  	 <li><a class="trigger" href="login.php" target="_self">Đăng nhập</a>			
			<? }else{?>
			 <li class="linemenus"></li>					 
		  	 <li><a class="trigger" href="logout.php" target="_self">Thoát</a>			
			 <li class="linemenus"></li>
			 <li><a class="trigger">
			 	<?
		$nguoidung=$_SESSION["username"];
		if($_SESSION["quyen"]==0){
		$resu23=mysql_query("select * from admin where maadmin='{$nguoidung}'");
		$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["hotendem"]."&nbsp;".$row23["ten"]; ?>
			</font>
		<? }else if($_SESSION["quyen"]==1){
			$resu23=mysql_query("select * from giaovien where magv='{$nguoidung}'");
			$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["hotendem"]."&nbsp;".$row23["ten"]; ?>
			</font>
		<? }else if($_SESSION["quyen"]==2){
			$resu23=mysql_query("select * from phuhuynh where maph='{$nguoidung}'");
			$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["tenph"]; ?>
			</font>
		<? }else if(($_SESSION["quyen"]==3)||($_SESSION["quyen"]==4)){
				$resu23=mysql_query("select * from hocsinh where mahs='{$nguoidung}'");
				$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["hotendem"]."&nbsp;".$row23["ten"]; ?>
			</font>
		<? }
	}?>
		  <!--het-->		 
		</ul>
	</div>
	</td></tr>
	<tr>
		<td width="160px" height="800" valign="top">
		<!--menu trai-->		
		<table align="center" width="100%" border="1" cellpadding="0" cellspacing="0">
		<tr><td valign="middle" height="30">
			<a href="sodaubai.php?mal=<? echo $malop;?>"><img src="anh/sodaubai.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="sodaubai.php?mal=<? echo $malop;?>">Sổ đầu bài</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="danhsachhocsinh.php?mal=<? echo $malop;?>"><img src="anh/user.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="danhsachhocsinh.php?mal=<? echo $malop;?>">Danh sách học sinh</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="thuvienanhlop.php?mal=<? echo $malop;?>.php"><img src="anh/album.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="thuvienanhlop.php?mal=<? echo $malop;?>">Thư viện ảnh</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="lopcuatoi_baiviet.php?mal=<? echo $malop;?>"><img src="anh/baiviet.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="lopcuatoi_baiviet.php?mal=<? echo $malop;?>">Bài viết</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="thoikhoabieu.php?mal=<? echo $malop;?>"><img src="anh/thoikhoabieu.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="thoikhoabieu.php?mal=<? echo $malop;?>">Thời khóa biểu</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="thongbaolop.php?mal=<? echo $malop;?>"><img src="anh/thongbao.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="thongbaolop.php?mal=<? echo $malop;?>">Thông báo</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="tailieulop.php?mal=<? echo $malop;?>""><img src="anh/tailieu.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="tailieulop.php?mal=<? echo $malop;?>">Tài liệu Upload</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="xemdiemlop.php?mal=<? echo $malop;?>""><img src="anh/xemdiem.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="xemdiemlop.php?mal=<? echo $malop;?>">Xem điểm</a>
		</td></tr>			
		</table>
		<!-- het menu trai-->
	</td>
		
    <td align="center" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->		
	<!--Begin -->
	<?
		$masdb=$_REQUEST["masdb"];
		$mal=$_REQUEST["mal"];
		$result=mysql_query("select * from sodaubai where masdb='{$masdb}'");
		$r=mysql_fetch_array($result);
	?>
		<table align="right" width="99%" cellpadding="2" cellspacing="2" border="0">
		<tr>
			<td align="center">
			<!--Begin tieu de-->
				<div class="sodaubai">
					<div class="gift_quatang_topblog">
						<p class="gift_quatang_fl_left"><img src="anh/space.gif"></p>
						<p class="gift_quatang_fl_right"><img src="anh/space.gif"></p>
					</div>
					<div class="noidungsodaubai">
						<h1></h1>
							<font size="+2" color="#003366">
								Sổ đầu bài lớp <? 								
								$result1=mysql_query("select * from lop where mal='{$mal}'");
								$r1=mysql_fetch_array($result);
								echo $r1["tenl"];
								?>	
							</font>																		 
						<div class="gift_quatang_mView">
							<span style="float:left; width:100px;"> 
							</span>
							<span style=" float: right;">
												 <font color="#476da4">
												 </font>			
							</span>
						</div>
					</div>
					<div class="gift_quatang_btmblog">
						<p class="gift_quatang_bl_left"><img src="anh/space.gif"></p>
						<p class="gift_quatang_bl_right"><img src="anh/space.gif"></p>
					</div>			
				</div>
			<!--End tieu de-->			
			<!--Begin them nhan xet-->
				<div class="sodaubai">
					<div class="gift_quatang_topblog">
						<p class="gift_quatang_fl_left"><img src="anh/space.gif"></p>
						<p class="gift_quatang_fl_right"><img src="anh/space.gif"></p>
					</div>
					<div class="noidungsodaubai">
						<h1 align="left">Sửa nhận xét</h1>
					<form name="f" action="suasodaubai_action.php" method="post">
                  <table width="95%" border="1" cellspacing="5" cellpadding="0">
                    <tr>
                      <td valign="top">Ngày </td>
					  <td>
					  <input type="hidden" name="lopid" id="lopid" value="<? echo $mal;?>">		
					  <input type="hidden" name="sdbid" id="sdbid" value="<? echo $masdb;?>">				 					 
                     <input name="demol1" id="demo11" type="text" size="25" value="<? echo $r["ngay"];?>"><a href="javascript:NewCal('demo11','ddmmyyyy')"><img src="anh/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
					 </td>
                    </tr>
                    <tr> 
                      <td valign="top">Tiết học</td>
                      <td><input type="text" name="tiethoc" value="<? echo $r["tiethoc"];?>"></td>
                    </tr>
                    <tr>
                      <td valign="top">Môn học</td>
					  <td><select name="mamh" id="mamh">
						  <? $result2 = mysql_query("select * from monhoc order by tenmh");
						  	while ($r2 = mysql_fetch_array($result2)){
							echo "<option value={$r2["mamh"]}";
									$result3 = mysql_query("select * from sodaubai where masdb={$r["masdb"]}");
										while ($r3=mysql_fetch_array($result3)){
											if ($r2["mamh"]==$r["mamh"]) { echo " selected"; break;
														}
										}
							
							echo ">{$r2["tenmh"]}";echo "</option>";
							}
						  ?>
						  </select></td>                      
                    </tr>
                    <tr>
                      <td valign="top">Bài học</td>
                      <td><input type="text" name="baihoc" value="<? echo $r["baihoc"];?>"></td>
                    </tr>
                    <tr>
                      <td valign="top">Nhận xét</td>
                      <td><textarea name="nhanxet" cols="45" rows="5"><? echo $r["nhanxet"];?></textarea></td>
                    </tr>
					<tr>
                      <td valign="top">Học sinh vắng</td>
                      <td><textarea name="vang" cols="45" rows="3"><? echo $r["vang"];?></textarea></td>
                    </tr>
                    <tr>
                      <td valign="top">Xếp loại</td>
                      <td>
					  	<select name="xeploai" id="xeploai">
							<option value="1">Tốt</option>
							<option value="2">Khá</option>
							<option value="3">Trung bình</option>
							<option value="4">Yếu</option>
						</select>
					  </td>
                    </tr>
                    <tr>
                      <td valign="top">Giáo viên</td>
					  <td><select name="magv" id="magv">
						  <? $result4 = mysql_query("select * from giaovien order by ten");
						  while ($r4 = mysql_fetch_array($result4)){
							echo "<option value={$r4["magv"]}";
									$result5 = mysql_query("select * from sodaubai where masdb={$r["masdb"]}");
										while ($r5=mysql_fetch_array($result5)){
											if ($r5["magv"]==$r4["magv"]) { echo " selected"; break;
														}
																}
							
							echo ">{$r4["hotendem"]}";echo "&nbsp;";echo $r4["ten"];echo "</option>";
							}
						  ?>
						  </select></td>
                    </tr>
                    <tr>
                      <td align="right" valign="top"><input type="submit" name="Submit" value="Sửa" onClick="return kt();"></td>
                      <td align="left"><input type="reset" name="Submit2" value="Reset"></td>
                    </tr>
					<script language="JavaScript">
						function kt(){
							if(f.tiethoc.value=="")
							{
								alert("Tiết học không được để trống !");
								f.tiethoc.focus();
								return false;
							}
							r=/^\d+$/;
							if(r.test(f.tiethoc.value)==false)
							{
								alert("Tiết học phải là số tự nhiên lớn hơn 0!");
								f.tiethoc.focus();
								return false;
							};  
							if(f.baihoc.value=="")
							{
								alert("Bài học không được để trống !");
								f.baihoc.focus();
								return false;
							}
							if(f.nhanxet.value=="")
							{
								alert("Nhận xét của giáo viên không được để trống !");
								f.nhanxet.focus();
								return false;
							}							
							return true;
						}
					</script>
                  </table>
                </form>
						<div class="sodaubai_bottom">
							<span style="float:left; width:100px;">
						<!--Neu la giao vien thi hien link-->
								
							</span>
							<span style=" float: right;">
												 <font color="#476da4">
								
												 </font>			
							</span>
						</div>
					</div>
					<div class="gift_quatang_btmblog">
						<p class="gift_quatang_bl_left"><img src="anh/space.gif"></p>
						<p class="gift_quatang_bl_right"><img src="anh/space.gif"></p>
					</div>			
				</div>
			<!--End them nhan xet-->
			
			</td>
		</tr>
		</table>
	<!--End-->	
	<!-- InstanceEndEditable --></td>
	
	</tr>
	<tr><td colspan="2" align="center" valign="middle" bgcolor="#999999" height="100">Phạm Đức Đóa - Khoa CNTT - Đại học Xây Dựng</td></tr>
</table>
</body>
<!-- InstanceEnd --></html>
